package org.wu.framework.bean.definition;

import lombok.Setter;

import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.List;

/**
 * 抽象的 bean 定义
 */
@Setter
public abstract class AbstractBeanDefinition implements BeanDefinition {


    /**
     * bean class
     */
    private Class<?> beanClass;

    /**
     * 构造方法
     */
    private Constructor<?> constructor;

    /**
     * 构造方法参数
     */
    private Class<?>[] parameterTypes;

    /**
     * 注入字段
     */
    private List<Field> injectingFields;
    /**
     * 通过方法注入
     */
    private List<Method> injectingMethods;

    /**
     * 初始化方法
     */
    private List<Method> initMethods;


    private Class<?>[] dependsOn;


    @Override
    public Class<?> getBeanClass() {
        return beanClass;
    }

    @Override
    public Constructor<?> getConstructor() {
        return constructor;
    }

    @Override
    public List<Field> getInjectingFields() {
        return injectingFields;
    }

    @Override
    public List<Method> getInjectingMethods() {
        return injectingMethods;
    }

    @Override
    public List<Method> getInitMethods() {
        return initMethods;
    }

    @Override
    public Class<?>[] getDependsOn() {
        return dependsOn;
    }

    /**
     * 构造方法参数
     */
    @Override
    public Class<?>[] getParameterTypes() {
        return parameterTypes;
    }
}
